#pragma once
#include"UIControl.h"

BEGIN_NAMESPACE(ui_manager)
class UIManager;
typedef std::shared_ptr<UIManager> UIManagerSharedPtr;
BEGIN_NAMESPACE(ui_controls)

class UIControlContainer;
typedef std::shared_ptr<UIControlContainer> UIControlContainerPtr;

// interface for control containers
class UIControlContainer : public UIControl
{
public:
//=====================================
// Constructors, Destructor, Operators
//=====================================
	UIControlContainer();
	~UIControlContainer();
//=====================================
// Functionality
//=====================================

	//========== Description ==========
	//PURPOSE : Add a child to the control
	//REQUIRE : A UIControl pointer, NO NOT call delete on pointers
	// assigned to the container
	//PROMISE : Add the child specified
	void AddChild(UIControl* child);
	//========== Description ==========
	//PURPOSE : Remove a child from the control
	//REQUIRE : A non-empty string
	//PROMISE : Remove the child that has name equal to the one specified
	void RemoveChild(std::string child_name);
	//========== Description ==========
	//PURPOSE : None
	//REQUIRE : Nothing
	//PROMISE : Nothing
	UIControl* getChild(std::string child_name);
	//========== Description ==========
	//PURPOSE : Post event to children and siblings
	//REQUIRE : UIEvent object with valid information
	//PROMISE : Post the event to the children and siblings of this control
	void PostEvent(ui_events::UIEvent ui_event);
	//========== Description ==========
	//PURPOSE : None
	//REQUIRE : Nothing
	//PROMISE : Nothing
	void Clear();
private:
	std::list<ui_controls::UIControl*> children_;

	UIControlContainer(const UIControlContainer&);
	UIControlContainer& operator= (const UIControlContainer&);
};

END_NAMESPACE // UI controls
END_NAMESPACE // UI manager